package 数子统计;

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int l = in.nextInt();
        int r = in.nextInt();
        int res = 0;
        for (int i = l; i <= r; i++) {
            int x = i;
            while (x != 0) {
                if (x % 10 == 2) {
                    res++;
                }
                x /= 10;
            }
        }
        System.out.println(res);
    }
}
